package polimi.sc.expoquest.storage.model;

import java.util.ArrayList;
import java.util.Collection;

/**
 * This class represents a game played by an user
 * @author Monica Lozano
 */
public class PlayedGame {
	//----------------
	//ATTRIBUTES
	//----------------
	/**
	 * ID in the database, this id is related to the _id column
	 * of the table, and this is automatically autoincremented
	 */
	private int id;
	/**
	 * The user that has played
	 */
	private User user;
	/**
	 * The single game that the user has played
	 */
	private SingleGame game;
	/**
	 * Tags added to the picture taken in the game, when the game is of TYPE_CAMERA
	 */
	private Collection<Tag> tags;
	/**
	 * The option selected by the user when playing a game TYPE_TRIVIA
	 */
	private GameOption option;
	/**
	 * Points earn by the user
	 */
	private int points;
	/**
	 * A possible related pic
	 */
	private String picURI;
	/**
	 * The related comment to the played game when it is TYPE_COMMENT
	 */
	private String comment;
	
	//----------------
	//CONSTRUCTOR
	//----------------
	public PlayedGame(){}
	/**
	 * 
	 * @param id
	 * @param game
	 * @param user
	 */
	public PlayedGame(int id, SingleGame game, User user)
	{
		this.id = id;
		this.game= game;
		this.user= user;
		tags= null;
		option= null;
	}
	
	/**
	 * Add a tag
	 * @param t
	 */
	public void addTag(Tag t)
	{
		if(tags== null)
			tags = new ArrayList<Tag>();
		tags.add(t);
	}
	
	
	//-------------------
	//GETTERS AND SETTERS
	//------------------

	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @return the user
	 */
	public User getUser() {
		return user;
	}

	/**
	 * @param user the user to set
	 */
	public void setUser(User user) {
		this.user = user;
	}

	/**
	 * @return the game
	 */
	public SingleGame getGame() {
		return game;
	}

	/**
	 * @param game the game to set
	 */
	public void setGame(SingleGame game) {
		this.game = game;
	}

	/**
	 * @return the tags
	 */
	public Collection<Tag> getTags() {
		return tags;
	}

	/**
	 * @param tags the tags to set
	 */
	public void setTags(Collection<Tag> tags) {
		this.tags = tags;
	}

	/**
	 * @return the option
	 */
	public GameOption getOption() {
		return option;
	}

	/**
	 * @param option the option to set
	 */
	public void setOption(GameOption option) {
		this.option = option;
	}
	/**
	 * @return the points
	 */
	public int getPoints() {
		return points;
	}
	/**
	 * @param points the points to set
	 */
	public void setPoints(int points) {
		this.points = points;
	}
	/**
	 * @return the picURI
	 */
	public String getPicURI() {
		return picURI;
	}
	/**
	 * @param picURI the picURI to set
	 */
	public void setPicURI(String picURI) {
		this.picURI = picURI;
	}
	/**
	 * @return the comment
	 */
	public String getComment() {
		return comment;
	}
	/**
	 * @param comment the comment to set
	 */
	public void setComment(String comment) {
		this.comment = comment;
	}
	
	
}
